#include "QQQuery.h"

qx::QxSqlQuery& QQQuery::select(const QString& table, const QStringList& columns)
{
	QString sql = "SELECT";
	sql += " ";
	QStringList keys;
	if (columns.isEmpty())
	{
		sql += "*";
	}
	else
	{
		for (int i = 0; i < columns.size(); ++i)
		{
			QString key = QString(":where_%1,").arg(m_lstValue.size());
			sql += key;
			keys << key.chopped(1);
		}
	}
	sql.chopped(1);
	sql += " ";
	sql += "FROM";
	sql += " ";
	sql += table;
	this->query(sql);
	for (int i = 0; i < keys.size(); ++i)
	{
		this->bind(keys[i], columns[i]);
	}
	return *this;
}

qx::QxSqlQuery& QQQuery::distinct()
{
	QString sql = this->query();
	sql += " ";
	sql += "DISTINCT";
	sql += " ";
	return this->query(sql);
}

qx::QxSqlQuery& QQQuery::where(const QString& column)
{
	QString sql = this->query();
	sql += " ";
	sql += "WHERE";
	sql += " ";
	QString key = QString(":where_%1").arg(m_lstValue.size());
	sql += key;
	sql += " ";
	return this->query(sql).bind(key, column);
}

qx::QxSqlQuery& QQQuery::where_OpenParenthesis(const QString& column)
{
	QString sql = this->query();
	sql += " ";
	sql += "WHERE";
	sql += " ";
	sql += "(";
	QString key = QString(":where_%1").arg(m_lstValue.size());
	sql += key;
	sql += " ";
	return this->query(sql).bind(key, column);
}

qx::QxSqlQuery& QQQuery::and_(const QString& column)
{
	QString sql = this->query();
	sql += " ";
	sql += "AND";
	sql += " ";
	QString key = QString(":where_%1").arg(m_lstValue.size());
	sql += key;
	sql += " ";
	return this->query(sql).bind(key, column);
}

qx::QxSqlQuery& QQQuery::and_OpenParenthesis(const QString& column)
{
	QString sql = this->query();
	sql += " ";
	sql += "AND";
	sql += " ";
	sql += "(";
	QString key = QString(":where_%1").arg(m_lstValue.size());
	sql += key;
	sql += " ";
	return this->query(sql).bind(key, column);
}

qx::QxSqlQuery& QQQuery::or_(const QString& column)
{
	QString sql = this->query();
	sql += " ";
	sql += "OR";
	sql += " ";
	QString key = QString(":where_%1").arg(m_lstValue.size());
	sql += key;
	sql += " ";
	return this->query(sql).bind(key, column);
}

qx::QxSqlQuery& QQQuery::or_OpenParenthesis(const QString& column)
{
	QString sql = this->query();
	sql += " ";
	sql += "OR";
	sql += " ";
	sql += "(";
	QString key = QString(":where_%1").arg(m_lstValue.size());
	sql += key;
	sql += " ";
	return this->query(sql).bind(key, column);
}

qx::QxSqlQuery& QQQuery::openParenthesis()
{
	QString sql = this->query();
	sql += " ";
	sql += "(";
	sql += " ";
	return this->query(sql);
}

qx::QxSqlQuery& QQQuery::closeParenthesis()
{
	QString sql = this->query();
	sql += " ";
	sql += ")";
	sql += " ";
	return this->query(sql);
}

qx::QxSqlQuery& QQQuery::orderAsc(const QStringList& columns)
{
	QString sql = this->query();
	sql += " ";
	sql += "ORDER";
	sql += " ";
	sql += "BY";
	sql += " ";
	QStringList keys;
	for (int i = 0; i < columns.size(); ++i)
	{
		QString key = QString(":order_%1,").arg(m_lstValue.size());
		sql += key;
		keys << key.chopped(1);
	}
	sql.chopped(1);
	sql += " ";
	this->query(sql);
	for (int i = 0; i < keys.size(); ++i)
	{
		this->bind(keys[i], columns[i]);
	}
	return *this;
}

qx::QxSqlQuery& QQQuery::orderAsc(const QString& col1)
{
	QString sql = this->query();
	sql += " ";
	sql += "ORDER";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key = QString(":order_%1").arg(m_lstValue.size());
	sql += key;
	sql += " ";
	this->query(sql);
	return this->bind(key, col1);
}

qx::QxSqlQuery& QQQuery::orderAsc(const QString& col1, const QString& col2)
{
	QString sql = this->query();
	sql += " ";
	sql += "ORDER";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":order_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":order_%1").arg(m_lstValue.size() + 1);
	sql += key2;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	return this->bind(key2, col2);
}

qx::QxSqlQuery& QQQuery::orderAsc(const QString& col1, const QString& col2, const QString& col3)
{
	QString sql = this->query();
	sql += " ";
	sql += "ORDER";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":order_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":order_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":order_%1").arg(m_lstValue.size() + 2);
	sql += key3;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	this->bind(key2, col2);
	return this->bind(key3, col3);
}

qx::QxSqlQuery& QQQuery::orderAsc(const QString& col1, const QString& col2, const QString& col3, const QString& col4)
{
	QString sql = this->query();
	sql += " ";
	sql += "ORDER";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":order_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":order_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":order_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":order_%1").arg(m_lstValue.size() + 3);
	sql += key4;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	this->bind(key2, col2);
	this->bind(key3, col3);
	return this->bind(key4, col4);
}

qx::QxSqlQuery& QQQuery::orderAsc(const QString& col1, const QString& col2, const QString& col3, const QString& col4, const QString& col5)
{
	QString sql = this->query();
	sql += " ";
	sql += "ORDER";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":order_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":order_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":order_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":order_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":order_%1").arg(m_lstValue.size() + 4);
	sql += key5;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	this->bind(key2, col2);
	this->bind(key3, col3);
	this->bind(key4, col4);
	return this->bind(key5, col5);
}

qx::QxSqlQuery& QQQuery::orderAsc(const QString& col1, const QString& col2, const QString& col3, const QString& col4, const QString& col5, const QString& col6)
{
	QString sql = this->query();
	sql += " ";
	sql += "ORDER";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":order_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":order_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":order_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":order_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":order_%1,").arg(m_lstValue.size() + 4);
	sql += key5;
	QString key6 = QString(":order_%1").arg(m_lstValue.size() + 5);
	sql += key6;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	this->bind(key2, col2);
	this->bind(key3, col3);
	this->bind(key4, col4);
	this->bind(key5, col5);
	return this->bind(key6, col6);
}

qx::QxSqlQuery& QQQuery::orderAsc(const QString& col1, const QString& col2, const QString& col3, const QString& col4, const QString& col5, const QString& col6, const QString& col7)
{
	QString sql = this->query();
	sql += " ";
	sql += "ORDER";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":order_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":order_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":order_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":order_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":order_%1,").arg(m_lstValue.size() + 4);
	sql += key5;
	QString key6 = QString(":order_%1,").arg(m_lstValue.size() + 5);
	sql += key6;
	QString key7 = QString(":order_%1").arg(m_lstValue.size() + 6);
	sql += key7;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	this->bind(key2, col2);
	this->bind(key3, col3);
	this->bind(key4, col4);
	this->bind(key5, col5);
	this->bind(key6, col6);
	return this->bind(key7, col7);
}

qx::QxSqlQuery& QQQuery::orderAsc(const QString& col1, const QString& col2, const QString& col3, const QString& col4, const QString& col5, const QString& col6, const QString& col7, const QString& col8)
{
	QString sql = this->query();
	sql += " ";
	sql += "ORDER";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":order_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":order_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":order_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":order_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":order_%1,").arg(m_lstValue.size() + 4);
	sql += key5;
	QString key6 = QString(":order_%1,").arg(m_lstValue.size() + 5);
	sql += key6;
	QString key7 = QString(":order_%1,").arg(m_lstValue.size() + 6);
	sql += key7;
	QString key8 = QString(":order_%1").arg(m_lstValue.size() + 7);
	sql += key8;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	this->bind(key2, col2);
	this->bind(key3, col3);
	this->bind(key4, col4);
	this->bind(key5, col5);
	this->bind(key6, col6);
	this->bind(key7, col7);
	return this->bind(key8, col8);
}

qx::QxSqlQuery& QQQuery::orderAsc(const QString& col1, const QString& col2, const QString& col3, const QString& col4, const QString& col5, const QString& col6, const QString& col7, const QString& col8, const QString& col9)
{
	QString sql = this->query();
	sql += " ";
	sql += "ORDER";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":order_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":order_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":order_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":order_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":order_%1,").arg(m_lstValue.size() + 4);
	sql += key5;
	QString key6 = QString(":order_%1,").arg(m_lstValue.size() + 5);
	sql += key6;
	QString key7 = QString(":order_%1,").arg(m_lstValue.size() + 6);
	sql += key7;
	QString key8 = QString(":order_%1,").arg(m_lstValue.size() + 7);
	sql += key8;
	QString key9 = QString(":order_%1").arg(m_lstValue.size() + 8);
	sql += key9;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	this->bind(key2, col2);
	this->bind(key3, col3);
	this->bind(key4, col4);
	this->bind(key5, col5);
	this->bind(key6, col6);
	this->bind(key7, col7);
	this->bind(key8, col8);
	return this->bind(key9, col9);
}

qx::QxSqlQuery& QQQuery::orderDesc(const QStringList& columns)
{
	QString sql = this->query();
	sql += " ";
	sql += "ORDER";
	sql += " ";
	sql += "BY";
	sql += " ";
	QStringList keys;
	for (int i = 0; i < columns.size(); ++i)
	{
		QString key = QString(":order_%1,").arg(m_lstValue.size());
		sql += key;
		keys << key.chopped(1);
	}
	sql.chopped(1);
	sql += " ";
	this->query(sql);
	for (int i = 0; i < keys.size(); ++i)
	{
		this->bind(keys[i], columns[i]);
	}
	return *this;
}

qx::QxSqlQuery& QQQuery::orderDesc(const QString& col1)
{
	QString sql = this->query();
	sql += " ";
	sql += "ORDER";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key = QString(":order_%1").arg(m_lstValue.size());
	sql += key;
	sql += " ";
	this->query(sql);
	return this->bind(key, col1);
}

qx::QxSqlQuery& QQQuery::orderDesc(const QString& col1, const QString& col2)
{
	QString sql = this->query();
	sql += " ";
	sql += "ORDER";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":order_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":order_%1").arg(m_lstValue.size() + 1);
	sql += key2;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	return this->bind(key2, col2);
}

qx::QxSqlQuery& QQQuery::orderDesc(const QString& col1, const QString& col2, const QString& col3)
{
	QString sql = this->query();
	sql += " ";
	sql += "ORDER";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":order_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":order_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":order_%1").arg(m_lstValue.size() + 2);
	sql += key3;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	this->bind(key2, col2);
	return this->bind(key3, col3);
}

qx::QxSqlQuery& QQQuery::orderDesc(const QString& col1, const QString& col2, const QString& col3, const QString& col4)
{
	QString sql = this->query();
	sql += " ";
	sql += "ORDER";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":order_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":order_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":order_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":order_%1").arg(m_lstValue.size() + 3);
	sql += key4;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	this->bind(key2, col2);
	this->bind(key3, col3);
	return this->bind(key4, col4);
}

qx::QxSqlQuery& QQQuery::orderDesc(const QString& col1, const QString& col2, const QString& col3, const QString& col4, const QString& col5)
{
	QString sql = this->query();
	sql += " ";
	sql += "ORDER";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":order_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":order_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":order_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":order_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":order_%1").arg(m_lstValue.size() + 4);
	sql += key5;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	this->bind(key2, col2);
	this->bind(key3, col3);
	this->bind(key4, col4);
	return this->bind(key5, col5);
}

qx::QxSqlQuery& QQQuery::orderDesc(const QString& col1, const QString& col2, const QString& col3, const QString& col4, const QString& col5, const QString& col6)
{
	QString sql = this->query();
	sql += " ";
	sql += "ORDER";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":order_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":order_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":order_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":order_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":order_%1,").arg(m_lstValue.size() + 4);
	sql += key5;
	QString key6 = QString(":order_%1").arg(m_lstValue.size() + 5);
	sql += key6;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	this->bind(key2, col2);
	this->bind(key3, col3);
	this->bind(key4, col4);
	this->bind(key5, col5);
	return this->bind(key6, col6);
}

qx::QxSqlQuery& QQQuery::orderDesc(const QString& col1, const QString& col2, const QString& col3, const QString& col4, const QString& col5, const QString& col6, const QString& col7)
{
	QString sql = this->query();
	sql += " ";
	sql += "ORDER";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":order_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":order_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":order_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":order_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":order_%1,").arg(m_lstValue.size() + 4);
	sql += key5;
	QString key6 = QString(":order_%1,").arg(m_lstValue.size() + 5);
	sql += key6;
	QString key7 = QString(":order_%1").arg(m_lstValue.size() + 6);
	sql += key7;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	this->bind(key2, col2);
	this->bind(key3, col3);
	this->bind(key4, col4);
	this->bind(key5, col5);
	this->bind(key6, col6);
	return this->bind(key7, col7);
}

qx::QxSqlQuery& QQQuery::orderDesc(const QString& col1, const QString& col2, const QString& col3, const QString& col4, const QString& col5, const QString& col6, const QString& col7, const QString& col8)
{
	QString sql = this->query();
	sql += " ";
	sql += "ORDER";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":order_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":order_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":order_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":order_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":order_%1,").arg(m_lstValue.size() + 4);
	sql += key5;
	QString key6 = QString(":order_%1,").arg(m_lstValue.size() + 5);
	sql += key6;
	QString key7 = QString(":order_%1,").arg(m_lstValue.size() + 6);
	sql += key7;
	QString key8 = QString(":order_%1").arg(m_lstValue.size() + 7);
	sql += key8;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	this->bind(key2, col2);
	this->bind(key3, col3);
	this->bind(key4, col4);
	this->bind(key5, col5);
	this->bind(key6, col6);
	this->bind(key7, col7);
	return this->bind(key8, col8);
}

qx::QxSqlQuery& QQQuery::orderDesc(const QString& col1, const QString& col2, const QString& col3, const QString& col4, const QString& col5, const QString& col6, const QString& col7, const QString& col8, const QString& col9)
{
	QString sql = this->query();
	sql += " ";
	sql += "ORDER";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":order_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":order_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":order_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":order_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":order_%1,").arg(m_lstValue.size() + 4);
	sql += key5;
	QString key6 = QString(":order_%1,").arg(m_lstValue.size() + 5);
	sql += key6;
	QString key7 = QString(":order_%1,").arg(m_lstValue.size() + 6);
	sql += key7;
	QString key8 = QString(":order_%1,").arg(m_lstValue.size() + 7);
	sql += key8;
	QString key9 = QString(":order_%1").arg(m_lstValue.size() + 8);
	sql += key9;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	this->bind(key2, col2);
	this->bind(key3, col3);
	this->bind(key4, col4);
	this->bind(key5, col5);
	this->bind(key6, col6);
	this->bind(key7, col7);
	this->bind(key8, col8);
	return this->bind(key9, col9);
}

qx::QxSqlQuery& QQQuery::groupBy(const QStringList& columns)
{
	QString sql = this->query();
	sql += " ";
	sql += "GROUP";
	sql += " ";
	sql += "BY";
	sql += " ";
	QStringList keys;
	for (int i = 0; i < columns.size(); ++i)
	{
		QString key = QString(":group_%1,").arg(m_lstValue.size());
		sql += key;
		keys << key.chopped(1);
	}
	sql.chopped(1);
	sql += " ";
	this->query(sql);
	for (int i = 0; i < keys.size(); ++i)
	{
		this->bind(keys[i], columns[i]);
	}
	return *this;
}

qx::QxSqlQuery& QQQuery::groupBy(const QString& col1)
{
	QString sql = this->query();
	sql += " ";
	sql += "GROUP";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key = QString(":group_%1").arg(m_lstValue.size());
	sql += key;
	sql += " ";
	this->query(sql);
	return this->bind(key, col1);
}

qx::QxSqlQuery& QQQuery::groupBy(const QString& col1, const QString& col2)
{
	QString sql = this->query();
	sql += " ";
	sql += "GROUP";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":group_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":group_%1").arg(m_lstValue.size() + 1);
	sql += key2;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	return this->bind(key2, col2);
}

qx::QxSqlQuery& QQQuery::groupBy(const QString& col1, const QString& col2, const QString& col3)
{
	QString sql = this->query();
	sql += " ";
	sql += "GROUP";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":group_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":group_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":group_%1").arg(m_lstValue.size() + 2);
	sql += key3;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	this->bind(key2, col2);
	return this->bind(key3, col3);
}

qx::QxSqlQuery& QQQuery::groupBy(const QString& col1, const QString& col2, const QString& col3, const QString& col4)
{
	QString sql = this->query();
	sql += " ";
	sql += "GROUP";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":group_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":group_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":group_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":group_%1").arg(m_lstValue.size() + 3);
	sql += key4;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	this->bind(key2, col2);
	this->bind(key3, col3);
	return this->bind(key4, col4);
}

qx::QxSqlQuery& QQQuery::groupBy(const QString& col1, const QString& col2, const QString& col3, const QString& col4, const QString& col5)
{
	QString sql = this->query();
	sql += " ";
	sql += "GROUP";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":group_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":group_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":group_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":group_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":group_%1").arg(m_lstValue.size() + 4);
	sql += key5;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	this->bind(key2, col2);
	this->bind(key3, col3);
	this->bind(key4, col4);
	return this->bind(key5, col5);
}

qx::QxSqlQuery& QQQuery::groupBy(const QString& col1, const QString& col2, const QString& col3, const QString& col4, const QString& col5, const QString& col6)
{
	QString sql = this->query();
	sql += " ";
	sql += "GROUP";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":group_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":group_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":group_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":group_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":group_%1,").arg(m_lstValue.size() + 4);
	sql += key5;
	QString key6 = QString(":group_%1").arg(m_lstValue.size() + 5);
	sql += key6;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	this->bind(key2, col2);
	this->bind(key3, col3);
	this->bind(key4, col4);
	this->bind(key5, col5);
	return this->bind(key6, col6);
}

qx::QxSqlQuery& QQQuery::groupBy(const QString& col1, const QString& col2, const QString& col3, const QString& col4, const QString& col5, const QString& col6, const QString& col7)
{
	QString sql = this->query();
	sql += " ";
	sql += "GROUP";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":group_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":group_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":group_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":group_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":group_%1,").arg(m_lstValue.size() + 4);
	sql += key5;
	QString key6 = QString(":group_%1,").arg(m_lstValue.size() + 5);
	sql += key6;
	QString key7 = QString(":group_%1").arg(m_lstValue.size() + 6);
	sql += key7;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	this->bind(key2, col2);
	this->bind(key3, col3);
	this->bind(key4, col4);
	this->bind(key5, col5);
	this->bind(key6, col6);
	return this->bind(key7, col7);
}

qx::QxSqlQuery& QQQuery::groupBy(const QString& col1, const QString& col2, const QString& col3, const QString& col4, const QString& col5, const QString& col6, const QString& col7, const QString& col8)
{
	QString sql = this->query();
	sql += " ";
	sql += "GROUP";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":group_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":group_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":group_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":group_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":group_%1,").arg(m_lstValue.size() + 4);
	sql += key5;
	QString key6 = QString(":group_%1,").arg(m_lstValue.size() + 5);
	sql += key6;
	QString key7 = QString(":group_%1,").arg(m_lstValue.size() + 6);
	sql += key7;
	QString key8 = QString(":group_%1").arg(m_lstValue.size() + 7);
	sql += key8;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	this->bind(key2, col2);
	this->bind(key3, col3);
	this->bind(key4, col4);
	this->bind(key5, col5);
	this->bind(key6, col6);
	this->bind(key7, col7);
	return this->bind(key8, col8);
}

qx::QxSqlQuery& QQQuery::groupBy(const QString& col1, const QString& col2, const QString& col3, const QString& col4, const QString& col5, const QString& col6, const QString& col7, const QString& col8, const QString& col9)
{
	QString sql = this->query();
	sql += " ";
	sql += "GROUP";
	sql += " ";
	sql += "BY";
	sql += " ";
	QString key1 = QString(":group_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":group_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":group_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":group_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":group_%1,").arg(m_lstValue.size() + 4);
	sql += key5;
	QString key6 = QString(":group_%1,").arg(m_lstValue.size() + 5);
	sql += key6;
	QString key7 = QString(":group_%1,").arg(m_lstValue.size() + 6);
	sql += key7;
	QString key8 = QString(":group_%1,").arg(m_lstValue.size() + 7);
	sql += key8;
	QString key9 = QString(":group_%1").arg(m_lstValue.size() + 8);
	sql += key9;
	sql += " ";
	this->query(sql);
	this->bind(key1, col1);
	this->bind(key2, col2);
	this->bind(key3, col3);
	this->bind(key4, col4);
	this->bind(key5, col5);
	this->bind(key6, col6);
	this->bind(key7, col7);
	this->bind(key8, col8);
	return this->bind(key9, col9);
}

qx::QxSqlQuery& QQQuery::limit(int rowsCount, int startRow, bool withTies)
{
	QString sql = this->query();
	sql += " ";
	sql += "LIMIT";
	sql += " ";
	QString key1 = QString(":limit_%1").arg(m_lstValue.size());
	sql += key1;
	sql += " ";
	QString key2 = QString(":limit_%1").arg(m_lstValue.size() + 1);
	sql += key2;
	sql += " ";
	if (withTies)
	{
		sql += "WITH";
		sql += " ";
		sql += "TIES";
		sql += " ";
	}
	return this->query(sql).bind(key1, rowsCount).bind(key2, startRow);
}

qx::QxSqlQuery& QQQuery::like(const QString& val)
{
	QString sql = this->query();
	sql += " ";
	sql += "LIKE";
	sql += " ";
	QString key = QString(":like_%1").arg(m_lstValue.size());
	sql += key;
	sql += " ";
	return this->query(sql).bind(key, val);
}

qx::QxSqlQuery& QQQuery::notLike(const QString& val)
{
	QString sql = this->query();
	sql += " ";
	sql += "NOT";
	sql += " ";
	sql += "LIKE";
	sql += " ";
	QString key = QString(":like_%1").arg(m_lstValue.size());
	sql += key;
	sql += " ";
	return this->query(sql).bind(key, val);
}

qx::QxSqlQuery& QQQuery::startsWith(const QString& val)
{
	QString sql = this->query();
	sql += " ";
	sql += "LIKE";
	sql += " ";
	QString key = QString(":like_%1").arg(m_lstValue.size());
	sql += key;
	sql += " ";
	return this->query(sql).bind(key, val + "%");
}

qx::QxSqlQuery& QQQuery::endsWith(const QString& val)
{
	QString sql = this->query();
	sql += " ";
	sql += "LIKE";
	sql += " ";
	QString key = QString(":like_%1").arg(m_lstValue.size());
	sql += key;
	sql += " ";
	return this->query(sql).bind(key, "%" + val);
}

qx::QxSqlQuery& QQQuery::containsString(const QString& val)
{
	QString sql = this->query();
	sql += " ";
	sql += "LIKE";
	sql += " ";
	QString key = QString(":like_%1").arg(m_lstValue.size());
	sql += key;
	sql += " ";
	return this->query(sql).bind(key, "%" + val + "%");
}

qx::QxSqlQuery& QQQuery::isEqualTo(const QVariant& val)
{
	QString sql = this->query();
	sql += " ";
	sql += "=";
	sql += " ";
	QString key = QString(":equal_%1").arg(m_lstValue.size());
	sql += key;
	sql += " ";
	return this->query(sql).bind(key, val);
}

qx::QxSqlQuery& QQQuery::isNotEqualTo(const QVariant& val)
{
	QString sql = this->query();
	sql += " ";
	sql += "<>";
	sql += " ";
	QString key = QString(":equal_%1").arg(m_lstValue.size());
	sql += key;
	sql += " ";
	return this->query(sql).bind(key, val);
}

qx::QxSqlQuery& QQQuery::isGreaterThan(const QVariant& val)
{
	QString sql = this->query();
	sql += " ";
	sql += ">";
	sql += " ";
	QString key = QString(":greater_%1").arg(m_lstValue.size());
	sql += key;
	sql += " ";
	return this->query(sql).bind(key, val);
}

qx::QxSqlQuery& QQQuery::isGreaterThanOrEqualTo(const QVariant& val)
{
	QString sql = this->query();
	sql += " ";
	sql += ">=";
	sql += " ";
	QString key = QString(":greater_%1").arg(m_lstValue.size());
	sql += key;
	sql += " ";
	return this->query(sql).bind(key, val);
}

qx::QxSqlQuery& QQQuery::isLessThan(const QVariant& val)
{
	QString sql = this->query();
	sql += " ";
	sql += "<";
	sql += " ";
	QString key = QString(":less_%1").arg(m_lstValue.size());
	sql += key;
	sql += " ";
	return this->query(sql).bind(key, val);
}

qx::QxSqlQuery& QQQuery::isLessThanOrEqualTo(const QVariant& val)
{
	QString sql = this->query();
	sql += " ";
	sql += "<=";
	sql += " ";
	QString key = QString(":less_%1").arg(m_lstValue.size());
	sql += key;
	sql += " ";
	return this->query(sql).bind(key, val);
}

qx::QxSqlQuery& QQQuery::customOperator(const QString& sCustomOperator, const QVariant& val)
{
	QString sql = this->query();
	sql += " ";
	sql += sCustomOperator;
	sql += " ";
	QString key = QString(":custom_%1").arg(m_lstValue.size());
	sql += key;
	sql += " ";
	return this->query(sql).bind(key, val);
}

qx::QxSqlQuery& QQQuery::in(const QVariantList& values)
{
	QString sql = this->query();
	sql += " ";
	sql += "IN";
	sql += " ";
	QStringList keys;
	for (int i = 0; i < values.size(); ++i)
	{
		QString key = QString(":in_%1,").arg(m_lstValue.size());
		sql += key;
		keys << key.chopped(1);
	}
	sql.chopped(1);
	sql += " ";
	this->query(sql);
	for (int i = 0; i < keys.size(); ++i)
	{
		this->bind(keys[i], values[i]);
	}
	return *this;
}

qx::QxSqlQuery& QQQuery::in(const QVariant& val1)
{
	QString sql = this->query();
	sql += " ";
	sql += "IN";
	sql += " ";
	QString key1 = QString(":in_%1").arg(m_lstValue.size());
	sql += key1;
	sql += " ";
	return this->query(sql).bind(key1, val1);
}

qx::QxSqlQuery& QQQuery::in(const QVariant& val1, const QVariant& val2)
{
	QString sql = this->query();
	sql += " ";
	sql += "IN";
	sql += " ";
	QString key1 = QString(":in_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":in_%1").arg(m_lstValue.size() + 1);
	sql += key2;
	sql += " ";
	this->query(sql);
	this->bind(key1, val1);
	return this->bind(key2, val2);
}

qx::QxSqlQuery& QQQuery::in(const QVariant& val1, const QVariant& val2, const QVariant& val3)
{
	QString sql = this->query();
	sql += " ";
	sql += "IN";
	sql += " ";
	QString key1 = QString(":in_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":in_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":in_%1").arg(m_lstValue.size() + 2);
	sql += key3;
	sql += " ";
	this->query(sql);
	this->bind(key1, val1);
	this->bind(key2, val2);
	return this->bind(key3, val3);
}

qx::QxSqlQuery& QQQuery::in(const QVariant& val1, const QVariant& val2, const QVariant& val3, const QVariant& val4)
{
	QString sql = this->query();
	sql += " ";
	sql += "IN";
	sql += " ";
	QString key1 = QString(":in_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":in_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":in_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":in_%1").arg(m_lstValue.size() + 3);
	sql += key4;
	sql += " ";
	this->query(sql);
	this->bind(key1, val1);
	this->bind(key2, val2);
	this->bind(key3, val3);
	return this->bind(key4, val4);
}

qx::QxSqlQuery& QQQuery::in(const QVariant& val1, const QVariant& val2, const QVariant& val3, const QVariant& val4, const QVariant& val5)
{
	QString sql = this->query();
	sql += " ";
	sql += "IN";
	sql += " ";
	QString key1 = QString(":in_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":in_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":in_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":in_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":in_%1").arg(m_lstValue.size() + 4);
	sql += key5;
	sql += " ";
	this->query(sql);
	this->bind(key1, val1);
	this->bind(key2, val2);
	this->bind(key3, val3);
	this->bind(key4, val4);
	return this->bind(key5, val5);
}

qx::QxSqlQuery& QQQuery::in(const QVariant& val1, const QVariant& val2, const QVariant& val3, const QVariant& val4, const QVariant& val5, const QVariant& val6)
{
	QString sql = this->query();
	sql += " ";
	sql += "IN";
	sql += " ";
	QString key1 = QString(":in_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":in_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":in_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":in_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":in_%1,").arg(m_lstValue.size() + 4);
	sql += key5;
	QString key6 = QString(":in_%1").arg(m_lstValue.size() + 5);
	sql += key6;
	sql += " ";
	this->query(sql);
	this->bind(key1, val1);
	this->bind(key2, val2);
	this->bind(key3, val3);
	this->bind(key4, val4);
	this->bind(key5, val5);
	return this->bind(key6, val6);
}

qx::QxSqlQuery& QQQuery::in(const QVariant& val1, const QVariant& val2, const QVariant& val3, const QVariant& val4, const QVariant& val5, const QVariant& val6, const QVariant& val7)
{
	QString sql = this->query();
	sql += " ";
	sql += "IN";
	sql += " ";
	QString key1 = QString(":in_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":in_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":in_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":in_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":in_%1,").arg(m_lstValue.size() + 4);
	sql += key5;
	QString key6 = QString(":in_%1,").arg(m_lstValue.size() + 5);
	sql += key6;
	QString key7 = QString(":in_%1").arg(m_lstValue.size() + 6);
	sql += key7;
	sql += " ";
	this->query(sql);
	this->bind(key1, val1);
	this->bind(key2, val2);
	this->bind(key3, val3);
	this->bind(key4, val4);
	this->bind(key5, val5);
	this->bind(key6, val6);
	return this->bind(key7, val7);
}

qx::QxSqlQuery& QQQuery::in(const QVariant& val1, const QVariant& val2, const QVariant& val3, const QVariant& val4, const QVariant& val5, const QVariant& val6, const QVariant& val7, const QVariant& val8)
{
	QString sql = this->query();
	sql += " ";
	sql += "IN";
	sql += " ";
	QString key1 = QString(":in_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":in_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":in_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":in_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":in_%1,").arg(m_lstValue.size() + 4);
	sql += key5;
	QString key6 = QString(":in_%1,").arg(m_lstValue.size() + 5);
	sql += key6;
	QString key7 = QString(":in_%1,").arg(m_lstValue.size() + 6);
	sql += key7;
	QString key8 = QString(":in_%1").arg(m_lstValue.size() + 7);
	sql += key8;
	sql += " ";
	this->query(sql);
	this->bind(key1, val1);
	this->bind(key2, val2);
	this->bind(key3, val3);
	this->bind(key4, val4);
	this->bind(key5, val5);
	this->bind(key6, val6);
	this->bind(key7, val7);
	return this->bind(key8, val8);
}

qx::QxSqlQuery& QQQuery::in(const QVariant& val1, const QVariant& val2, const QVariant& val3, const QVariant& val4, const QVariant& val5, const QVariant& val6, const QVariant& val7, const QVariant& val8, const QVariant& val9)
{
	QString sql = this->query();
	sql += " ";
	sql += "IN";
	sql += " ";
	QString key1 = QString(":in_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":in_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":in_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":in_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":in_%1,").arg(m_lstValue.size() + 4);
	sql += key5;
	QString key6 = QString(":in_%1,").arg(m_lstValue.size() + 5);
	sql += key6;
	QString key7 = QString(":in_%1,").arg(m_lstValue.size() + 6);
	sql += key7;
	QString key8 = QString(":in_%1,").arg(m_lstValue.size() + 7);
	sql += key8;
	QString key9 = QString(":in_%1").arg(m_lstValue.size() + 8);
	sql += key9;
	sql += " ";
	this->query(sql);
	this->bind(key1, val1);
	this->bind(key2, val2);
	this->bind(key3, val3);
	this->bind(key4, val4);
	this->bind(key5, val5);
	this->bind(key6, val6);
	this->bind(key7, val7);
	this->bind(key8, val8);
	return this->bind(key9, val9);
}

qx::QxSqlQuery& QQQuery::notIn(const QVariantList& values)
{
	QString sql = this->query();
	sql += " ";
	sql += "NOT";
	sql += " ";
	sql += "IN";
	sql += " ";
	QStringList keys;
	for (int i = 0; i < values.size(); ++i)
	{
		QString key = QString(":in_%1,").arg(m_lstValue.size());
		sql += key;
		keys << key.chopped(1);
	}
	sql.chopped(1);
	sql += " ";
	this->query(sql);
	for (int i = 0; i < keys.size(); ++i)
	{
		this->bind(keys[i], values[i]);
	}
	return *this;
}

qx::QxSqlQuery& QQQuery::notIn(const QVariant& val1)
{
	QString sql = this->query();
	sql += " ";
	sql += "NOT";
	sql += " ";
	sql += "IN";
	sql += " ";
	QString key1 = QString(":in_%1").arg(m_lstValue.size());
	sql += key1;
	sql += " ";
	return this->query(sql).bind(key1, val1);
}

qx::QxSqlQuery& QQQuery::notIn(const QVariant& val1, const QVariant& val2)
{
	QString sql = this->query();
	sql += " ";
	sql += "NOT";
	sql += " ";
	sql += "IN";
	sql += " ";
	QString key1 = QString(":in_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":in_%1").arg(m_lstValue.size() + 1);
	sql += key2;
	sql += " ";
	this->query(sql);
	this->bind(key1, val1);
	return this->bind(key2, val2);
}

qx::QxSqlQuery& QQQuery::notIn(const QVariant& val1, const QVariant& val2, const QVariant& val3)
{
	QString sql = this->query();
	sql += " ";
	sql += "NOT";
	sql += " ";
	sql += "IN";
	sql += " ";
	QString key1 = QString(":in_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":in_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":in_%1").arg(m_lstValue.size() + 2);
	sql += key3;
	sql += " ";
	this->query(sql);
	this->bind(key1, val1);
	this->bind(key2, val2);
	return this->bind(key3, val3);
}

qx::QxSqlQuery& QQQuery::notIn(const QVariant& val1, const QVariant& val2, const QVariant& val3, const QVariant& val4)
{
	QString sql = this->query();
	sql += " ";
	sql += "NOT";
	sql += " ";
	sql += "IN";
	sql += " ";
	QString key1 = QString(":in_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":in_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":in_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":in_%1").arg(m_lstValue.size() + 3);
	sql += key4;
	sql += " ";
	this->query(sql);
	this->bind(key1, val1);
	this->bind(key2, val2);
	this->bind(key3, val3);
	return this->bind(key4, val4);
}

qx::QxSqlQuery& QQQuery::notIn(const QVariant& val1, const QVariant& val2, const QVariant& val3, const QVariant& val4, const QVariant& val5)
{
	QString sql = this->query();
	sql += " ";
	sql += "NOT";
	sql += " ";
	sql += "IN";
	sql += " ";
	QString key1 = QString(":in_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":in_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":in_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":in_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":in_%1").arg(m_lstValue.size() + 4);
	sql += key5;
	sql += " ";
	this->query(sql);
	this->bind(key1, val1);
	this->bind(key2, val2);
	this->bind(key3, val3);
	this->bind(key4, val4);
	return this->bind(key5, val5);
}

qx::QxSqlQuery& QQQuery::notIn(const QVariant& val1, const QVariant& val2, const QVariant& val3, const QVariant& val4, const QVariant& val5, const QVariant& val6)
{
	QString sql = this->query();
	sql += " ";
	sql += "NOT";
	sql += " ";
	sql += "IN";
	sql += " ";
	QString key1 = QString(":in_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":in_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":in_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":in_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":in_%1,").arg(m_lstValue.size() + 4);
	sql += key5;
	QString key6 = QString(":in_%1").arg(m_lstValue.size() + 5);
	sql += key6;
	sql += " ";
	this->query(sql);
	this->bind(key1, val1);
	this->bind(key2, val2);
	this->bind(key3, val3);
	this->bind(key4, val4);
	this->bind(key5, val5);
	return this->bind(key6, val6);
}

qx::QxSqlQuery& QQQuery::notIn(const QVariant& val1, const QVariant& val2, const QVariant& val3, const QVariant& val4, const QVariant& val5, const QVariant& val6, const QVariant& val7)
{
	QString sql = this->query();
	sql += " ";
	sql += "NOT";
	sql += " ";
	sql += "IN";
	sql += " ";
	QString key1 = QString(":in_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":in_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":in_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":in_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":in_%1,").arg(m_lstValue.size() + 4);
	sql += key5;
	QString key6 = QString(":in_%1,").arg(m_lstValue.size() + 5);
	sql += key6;
	QString key7 = QString(":in_%1").arg(m_lstValue.size() + 6);
	sql += key7;
	sql += " ";
	this->query(sql);
	this->bind(key1, val1);
	this->bind(key2, val2);
	this->bind(key3, val3);
	this->bind(key4, val4);
	this->bind(key5, val5);
	this->bind(key6, val6);
	return this->bind(key7, val7);
}

qx::QxSqlQuery& QQQuery::notIn(const QVariant& val1, const QVariant& val2, const QVariant& val3, const QVariant& val4, const QVariant& val5, const QVariant& val6, const QVariant& val7, const QVariant& val8)
{
	QString sql = this->query();
	sql += " ";
	sql += "NOT";
	sql += " ";
	sql += "IN";
	sql += " ";
	QString key1 = QString(":in_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":in_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":in_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":in_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":in_%1,").arg(m_lstValue.size() + 4);
	sql += key5;
	QString key6 = QString(":in_%1,").arg(m_lstValue.size() + 5);
	sql += key6;
	QString key7 = QString(":in_%1,").arg(m_lstValue.size() + 6);
	sql += key7;
	QString key8 = QString(":in_%1").arg(m_lstValue.size() + 7);
	sql += key8;
	sql += " ";
	this->query(sql);
	this->bind(key1, val1);
	this->bind(key2, val2);
	this->bind(key3, val3);
	this->bind(key4, val4);
	this->bind(key5, val5);
	this->bind(key6, val6);
	this->bind(key7, val7);
	return this->bind(key8, val8);
}

qx::QxSqlQuery& QQQuery::notIn(const QVariant& val1, const QVariant& val2, const QVariant& val3, const QVariant& val4, const QVariant& val5, const QVariant& val6, const QVariant& val7, const QVariant& val8, const QVariant& val9)
{
	QString sql = this->query();
	sql += " ";
	sql += "NOT";
	sql += " ";
	sql += "IN";
	sql += " ";
	QString key1 = QString(":in_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":in_%1,").arg(m_lstValue.size() + 1);
	sql += key2;
	QString key3 = QString(":in_%1,").arg(m_lstValue.size() + 2);
	sql += key3;
	QString key4 = QString(":in_%1,").arg(m_lstValue.size() + 3);
	sql += key4;
	QString key5 = QString(":in_%1,").arg(m_lstValue.size() + 4);
	sql += key5;
	QString key6 = QString(":in_%1,").arg(m_lstValue.size() + 5);
	sql += key6;
	QString key7 = QString(":in_%1,").arg(m_lstValue.size() + 6);
	sql += key7;
	QString key8 = QString(":in_%1,").arg(m_lstValue.size() + 7);
	sql += key8;
	QString key9 = QString(":in_%1").arg(m_lstValue.size() + 8);
	sql += key9;
	sql += " ";
	this->query(sql);
	this->bind(key1, val1);
	this->bind(key2, val2);
	this->bind(key3, val3);
	this->bind(key4, val4);
	this->bind(key5, val5);
	this->bind(key6, val6);
	this->bind(key7, val7);
	this->bind(key8, val8);
	return this->bind(key9, val9);
}

qx::QxSqlQuery& QQQuery::in_Select(const qx::QxSqlQuery& query)
{
	QString sql = this->query();
	sql += " ";
	sql += "IN";
	sql += " ";
	sql += "(";
	sql += const_cast<qx::QxSqlQuery&>(query).query();
	sql += ")";
	sql += " ";
	return this->query(sql);
}

qx::QxSqlQuery& QQQuery::notIn_Select(const qx::QxSqlQuery& query)
{
	QString sql = this->query();
	sql += " ";
	sql += "NOT";
	sql += " ";
	sql += "IN";
	sql += " ";
	sql += "(";
	sql += const_cast<qx::QxSqlQuery&>(query).query();
	sql += ")";
	sql += " ";
	return this->query(sql);
}

qx::QxSqlQuery& QQQuery::isEqualTo_Select(const qx::QxSqlQuery& query)
{
	QString sql = this->query();
	sql += " ";
	sql += "=";
	sql += " ";
	sql += "(";
	sql += const_cast<qx::QxSqlQuery&>(query).query();
	sql += ")";
	sql += " ";
	return this->query(sql);
}

qx::QxSqlQuery& QQQuery::isNotEqualTo_Select(const qx::QxSqlQuery& query)
{
	QString sql = this->query();
	sql += " ";
	sql += "<>";
	sql += " ";
	sql += "(";
	sql += const_cast<qx::QxSqlQuery&>(query).query();
	sql += ")";
	sql += " ";
	return this->query(sql);
}

qx::QxSqlQuery& QQQuery::isNull()
{
	QString sql = this->query();
	sql += " ";
	sql += "IS";
	sql += " ";
	sql += "NULL";
	sql += " ";
	return this->query(sql);
}

qx::QxSqlQuery& QQQuery::isNotNull()
{
	QString sql = this->query();
	sql += " ";
	sql += "IS";
	sql += " ";
	sql += "NOT";
	sql += " ";
	sql += "NULL";
	sql += " ";
	return this->query(sql);
}

qx::QxSqlQuery& QQQuery::isBetween(const QVariant& val1, const QVariant& val2)
{
	QString sql = this->query();
	sql += " ";
	sql += "BETWEEN";
	sql += " ";
	QString key1 = QString(":between_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":between_%1").arg(m_lstValue.size() + 1);
	sql += key2;
	sql += " ";
	return this->query(sql).bind(key1, val1).bind(key2, val2);
}

qx::QxSqlQuery& QQQuery::isNotBetween(const QVariant& val1, const QVariant& val2)
{
	QString sql = this->query();
	sql += " ";
	sql += "NOT";
	sql += " ";
	sql += "BETWEEN";
	sql += " ";
	QString key1 = QString(":between_%1,").arg(m_lstValue.size());
	sql += key1;
	QString key2 = QString(":between_%1").arg(m_lstValue.size() + 1);
	sql += key2;
	sql += " ";
	return this->query(sql).bind(key1, val1).bind(key2, val2);
}

qx::QxSqlQuery& QQQuery::freeText(const QString& text, const QVariantList& values)
{
	QString sql = this->query();
	sql += " ";
	sql += "MATCH";
	sql += " ";
	sql += "(";
	sql += text;
	sql += ")";
	sql += " ";
	sql += "AGAINST";
	sql += " ";
	QStringList keys;
	for (int i = 0; i < values.size(); ++i)
	{
		QString key = QString(":free_%1,").arg(m_lstValue.size());
		sql += key;
		keys << key.chopped(1);
	}
	sql.chopped(1);
	sql += " ";
	sql += "IN";
	sql += " ";
	sql += "(";
	for (int i = 0; i < values.size(); ++i)
	{
		sql += keys[i];
		sql += ",";
	}
	sql.chopped(1);
	sql += ")";
	sql += " ";
	this->query(sql);
	for (int i = 0; i < keys.size(); ++i)
	{
		this->bind(keys[i], values[i]);
	}
	return *this;
}

qx::QxSqlQuery& QQQuery::addJoinQuery(const QString& relationKeyOrAlias, const qx::QxSqlQuery& joinQuery)
{
	QString sql = this->query();
	sql += " ";
	sql += "JOIN";
	sql += " ";
	sql += "(";
	sql += const_cast<qx::QxSqlQuery&>(joinQuery).query();
	sql += ")";
	sql += " ";
	sql += relationKeyOrAlias;
	sql += " ";
	return this->query(sql);
}
